<?php



/**
 * This class defines the structure of the 'damages' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.damages.map
 */
class DamagesDamagesTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'damages.map.DamagesDamagesTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('damages');
        $this->setPhpName('Damages');
        $this->setClassname('DamagesDamages');
        $this->setPackage('damages');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 4, null);
        $this->addForeignKey('CAR_DAMAGE_ID', 'CarDamageId', 'INTEGER', 'car_damages', 'ID', true, 4, null);
        $this->addForeignKey('DICT_DAMAGE_TYPE_ID', 'DictDamageTypeId', 'INTEGER', 'dict_damage_types', 'ID', true, 4, null);
        $this->addForeignKey('DICT_DAMAGE_SPOT_ID', 'DictDamageSpotId', 'INTEGER', 'dict_damage_spots', 'ID', true, 4, null);
        $this->addForeignKey('DICT_DAMAGE_SCALE_ID', 'DictDamageScaleId', 'INTEGER', 'dict_damage_scale', 'ID', true, 4, null);
        $this->addColumn('IS_MAIN', 'IsMain', 'INTEGER', true, 4, 1);
        $this->addColumn('CREATED', 'Created', 'TIMESTAMP', true, 16, null);
        $this->addColumn('MODIFIED', 'Modified', 'TIMESTAMP', false, 16, null);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('CarDamages', 'DamagesCarDamages', RelationMap::MANY_TO_ONE, array('car_damage_id' => 'id', ), null, null);
        $this->addRelation('DictDamageTypes', 'DamagesDictDamageTypes', RelationMap::MANY_TO_ONE, array('dict_damage_type_id' => 'id', ), null, null);
        $this->addRelation('DictDamageSpots', 'DamagesDictDamageSpots', RelationMap::MANY_TO_ONE, array('dict_damage_spot_id' => 'id', ), null, null);
        $this->addRelation('DictDamageScale', 'DamagesDictDamageScale', RelationMap::MANY_TO_ONE, array('dict_damage_scale_id' => 'id', ), null, null);
    } // buildRelations()

} // DamagesDamagesTableMap
